<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Examples</title>
<meta name="description" content="">
<meta name="keywords" content="">
	<link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.min.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.min.css?v=4.0.0" rel="stylesheet">
</head>
<body>
    <div class="row">
    	<div class="col-sm-6">
    	</div>
      	<div class="col-sm-6">
            <div class="input-group pull-right">
            <form action="{:url('goodsList')}" method="get" enctype="application/x-www-form-urlencoded">
            <div class="input-group">
                <input type="text" placeholder="请输入关键词" class="input-sm form-control" value="{$Think.get.keywords ?? ''}" name="keywords">
                <span class="input-group-btn">
                    <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
            </div>
            </form>
            </div>
        </div>
        
    </div>
    <div class="table-responsive">
        <table class="table table-striped" id="listtable">
            <thead>
                <tr>
                    <!-- <th width="30"><input name="checkall" id="checkall"  type="checkbox" class="i-checks" value="1"></th> -->
                    <th width="100">商品图片</th>
                    <th width="">商品名称</th>
                    <th width="150">价格</th>
                    <th width="150">销量</th>
                    <th width="100">操作</th>
                </tr>
            </thead>
            <tbody>

            	{volist name="list" id="vo"}
                <tr data-id="{$vo.goods_id}" data-type="goods">
                    <!-- <td><input name="ids[]"  type="checkbox" class="i-checks" value="{$vo.goods_id}"></td> -->
                    <td><img src="{$vo.picture}" width="30" height="30"></td>
                    <td class="goodsname">{$vo.goods_name}</td>
                    <td class="price">{$vo.min_price}-{$vo.max_price}</td>
                    <td class="sales">{$vo.sales}</td>
                    <td><button type="button" class="btn btn-primary btn-xs addtoleft">&nbsp;&nbsp;&nbsp;+&nbsp;&nbsp;&nbsp;</button></td>
                </tr>
               {/volist}

            </tbody>
        </table>
    </div>
    <div>{$list->render()}</div>
    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.common_resource_url}js/majax.js"></script>
</body>
</html>
<script type="text/javascript">
	$('.addtoleft').click(function(){
		var goods = {}, tr = $(this).closest('tr'),
		id=tr.data('id'), 
		img=tr.find('img').attr('src'),
		name=tr.find('.goodsname').text(),
		price=tr.find('.price').text(),
		sales=tr.find('.sales').text();
		goods={id:id,img:img,name:name,price:price,sales:sales};
		parent.window.addGoods(goods);
	})
</script>